import axiosData from '@/api/axios';

export default {
  /**
   * @description:查询所有设备类型
   * @return {Array}
   */
  queryTree(params) {
    return axiosData.get('/v3/agricultural-equipment/v1/equipmentType/queryAll', params);
  },
  queryAll(params) {
    // return axiosData.post('/v3/agricultural-equipment/v1/equipment/queryAll', params);
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryAllNew?organization=${sessionStorage.organizationNo}&farming=${sessionStorage.farming}`, { ...params });
  },
  /**
   * @description:查询不可以删除的设备类型
   * @return {Array}
   */
  queryUndelete(params) {
    return axiosData.get('/v3/agricultural-equipment/v1/equipmentType/queryUndelete', params);
  },
  /**
   * @description: 新增设备类型
   * @param {Object} params *
   * @return {Object}
   */
  add(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipmentType/add', params);
  },
  /**
   * @description: 编辑设备类型
   * @param {Object} params *
   * @return {Object}
   */
  edit(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipmentType/edit', params);
  },
  /**
   * @description: 批量删除设备类型
   * @param {Object} params *
   * @return {Object}
   */
  delList(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipmentType/deleteAll', params);
  },
  /**
   * @description: 检测设备类型名称是否已被占用
   * @param {Object} params *
   * @return {Object}
   */
  queryBeOccupied(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryBeOccupied?equTypeName=${params}`);
  },
  /**
   * @description:查询所有顶级
   * @return {Array}
   */
  queryTopAll(params) {
    return axiosData.get('/v3/agricultural-equipment/v1/equipmentType/queryTopAll', params);
  },
  /**
   * @description:查询子集
   * @return {Array}
   */
  querySubAll(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/querySubAll?equipmentTypeCode=${params}`);
  }
};
